#------------------------ Server Script -----------------------------
#This script manages the server main database
# --- run command : python server.py 
#Actions to perform :
#1/ Open the socket 
#2/ Get data from stations
#3/ Get new users
#4/ Send new users to stations
#5/ Merge the data received
#6/ Send notifications to users when usage issue

#Created by Mathieu Martel - 02-09-2010 
#-------------------------------------------------------------------

import sqlite3
import sys
import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)		#create a socket object
host = 'localhost' #socket.getaddrinfo('localhost', None)
print host
port = 12345			#port
s.bind((host, port))		#bind to the port

s.listen(1)			#wait for the client connection
while True:
	c, addr = s.accept() 	#establish connection with a client
	print 'Got a station connected'
	c.send('Thank you for connecting')
	c.close()		#close the connection


